1. Field of the Invention
This invention relates to digital cameras, and more particularly to a method and apparatus for performing color adjustment upon images taken with a digital camera.
2. Description of Related Art
Digital still cameras are being developed today to allow an image to be captured, digitized, stored, and reproduced using conventional printers coupled to a conventional personal computer. Inmost cases, an array of charge-coupled-device (CCD) detectors are used to capture the image. Each detector of the CCD array is used to capture one portion of the image. When light is received by a CCD detector, an electrical charge representative of the intensity of the light to which the detector has been exposed is accumulated. This charge can be coupled to an A/D (analog to digital) converter. The A/D convertor produces a digital value that represents the charge on each of the detectors, and thus the intensity of the light received by each detector.
If a color image is to be captured, then color filters are placed before each detector of the CCD array. Accordingly, a detector which is associated with a filter that passes essentially only red light will form a red detector. The color detectors are frequently arranged in groups. For example, in one well known arrangement, two green detectors, a blue detector, and a red detector form a two by two grouping. This grouping is repeated throughout the array of detectors. By taking the digital value associated with each detector, the color composition of the image is captured.
One problem that is encountered is that the amount of color detected by each detector may be altered due to the composition of the spectrum of light emitted by the particular light source which illuminates the image. For example, if an image is illuminated by a tungsten light source, then the image will be shifted toward the red spectrum, since tungsten light sources emit more red light than blue or green light. This shift will give the resulting photograph an undesirable reddish/orangish appearance.
In accordance with one method that has been used to process an image to adjust for differences in the nature of the light, variable gain amplifiers are provided in line with the red and blue signals. The amount of gain applied to the red and blue signals is adjusted to compensate for the type of light which illuminates the image. A manual control on the camera allows the user to select between tungsten mode and daylight mode. In tungsten mode, the gains of the amplifiers that are responsible for amplifying the output from the red and blue detectors are set to a first gain ratio to compensate for the blue shift. In daylight mode, a second gain ratio is used which causes the gain of the amplifiers responsible for amplifying the red and blue signals to be approximately equal to the amount of gain which is set for the green signals.
Selection of the particular gain ratio is also dependent upon the state of a relay. The relay overrides the manual control when a flash has been charged, since the use of a flash will alter the color composition of the image. That is, the gain ratio of the color signal amplifiers should be essentially the same when capturing an image using a flash device and when capturing an image during daylight. Therefore, when a flash device is charged to illuminate an image, the relay sets the mode of the variable gain amplifiers to the daylight setting, as is appropriate in the case in which a flash is to be used. Thus, by altering the gain of the amplifiers responsible for amplifying the outputs from the red and blue detectors, the color is properly balanced for the case in which an image is to be captured in tungsten lighting, daylight, or when a flash is used.
However, this system can improperly adjust the color of the image that is captured if the flash is charged, but not actually activated. Furthermore, the amount of color adjustment that is preformed is essentially fixed at one of two particular ratios (i.e., the gain of the amplifiers is set to one of two levels). Accordingly, if the amount of color adjustment that is required is other than that which would be desirable if the image were illuminated solely by tungsten or solely by natural sunlight, then the color of the image will be improperly adjusted. Still further, not every tungsten light source will have exactly the same color temperature (spectral composition of wavelengths).
A common way in which digital cameras have attempted to white balance an image requires that a preview image be taken. The preview image is used to determine the amount of adjustment that is required in order to white balance the image. There are several historical reasons why a preview image is used to determine the amount of adjustment that is required to white balance an image that is taken some time later. For example, in the case in which the adjustment is made by adjusting the gain of the amplifiers to which the output from the CCD array is coupled, the white balance information must be known at the time the image is read from the CCD array.
However, the adjustment will be incorrect if the illumination of the image differs between the time the preview image is taken and the time the final image is taken. For example, if the preview image is taken without a flash, and the final image is taken with a flash, then the correction that is made to the final image based upon the characteristics of the preview image will be incorrect. A number of other situations can arise which would cause the illumination of the preview image to differ from the illumination of the final image. For example, the sun may become obscured by a cloud, a light may be turned on or off, etc.
Accordingly, it would be desirable to provide a system wherein the color adjustment is determined in a way that accurately reflects the characteristics of the final image. Furthermore, it would be desirable to provide a system wherein the amount of color adjustment can be adjusted to compensate for several different conditions and combinations of light sources.
The present invention provides a method and apparatus for performing color balance of an image taken with a digital camera using either a host computer that is external to the camera or in a device internal to the camera using the image data of the image to be white balance adjusted in order to determine the amount of adjustment required.
In accordance with the present invention, a digital image is captured by: first flushing, at a first point in time, any charge which has accumulated on a CCD light detector array; allowing light to strike the CCD detector after the detector has been flushed; and determining the amount of charge that has accumulated upon the detectors that comprise the array. Once the image has been captured, a determination must be made as to whether the image requires white balancing. White balancing is typically required if the light source that illuminates objects to be imaged has a xe2x80x9ccolor temperaturexe2x80x9d that would cause the image to be tinted or biased in favor of, or away from, one color. For example, a tungsten light source will typically be biased in favor red. Therefore, in order for the image to be properly white balanced, the red component of each pixel must be adjusted with respect to the blue and green components of each pixel.
In accordance with the present invention, the amount of the adjustment which is to be made is determined by analysis of the image data to be adjusted (i.e., the xe2x80x9cpicture imagexe2x80x9d). In accordance with one embodiment of the present invention, image pixels within the picture image are mapped into a two dimensional space, the two dimensions of this space being red/blue and green/blue. Image pixels that make up a reference image that was illuminated by a reference light source are then plotted in the two dimensional space. Each of the points at the periphery of the picture image are mapped into points at the periphery of the reference image by a transform. The transforms that are used to map the points in the picture image to the points in the reference image are then plotted in a transform space. A shape is defined in the transform space by the set of transforms associated with each of the points on the periphery of the
picture image. Accordingly, a set of such shapes in the transform space will be defined for the picture image. The intersection of these shapes is then used to determine the source of light that illuminates the picture image and the adjustment factors required to properly white balance the picture image.
It will be clear that since the image data to be adjusted is used to determine the amount of the adjustment that is required, the adjustment will be more precise than would be the case if a preview image were taken to determine how to adjust the picture image.
In accordance with one embodiment of the present invention, the analysis and adjustment of the image data is performed in the camera. However, in an alternative embodiment of the present invention, the adjustment is performed outside the camera by a host device, such as a personal computer or printer.